home *** CD-ROM | disk | FTP | other *** search
- class classes.misc.WheelBot
- {
- var x;
- var y;
- var clip;
- var dir;
- var doorOpen;
- var oldDir;
- var c = 0;
- var c2 = 0;
- var cMax = 0;
- var c2Max = 0;
- var xMov = 0;
- var xMovT = 0;
- var xA = 0;
- var yA = 0;
- var f2 = "";
- var comp1D = false;
- var comp2D = false;
- var Name = "wheelBot";
- function WheelBot(px, py)
- {
- this.x = px;
- this.y = py;
- this.clip = _root.attachMovie("wheelBot","wheelBotClip",90020);
- this.clip._x = this.x;
- this.clip._y = this.y;
- this.xMov = this.xMovT = 4;
- this.dir = "R";
- _root.introScreen.littleDoorBlack._visible = true;
- _root.introOverlay.littleDoor.gotoAndPlay("open");
- }
- function wander()
- {
- if(random(200) > 197)
- {
- this.dir = this.dir != "L" ? "L" : "R";
- this.xMovT = this.dir != "L" ? 4 : -4;
- }
- else if(random(200) > 197)
- {
- this.comp1();
- }
- else if(random(200) > 197)
- {
- this.comp2();
- }
- else if(this.comp1D && this.comp2D && random(200) > 190)
- {
- this.goHome();
- }
- }
- function goHome()
- {
- if(this.x < 130)
- {
- this.dir = "R";
- this.xMovT = 4;
- this.f2 = "goingHomePoint";
- }
- else
- {
- this.dir = "L";
- this.xMovT = -4;
- this.f2 = "goingHome";
- }
- }
- function goingHome()
- {
- if(this.x < 130 && !this.doorOpen)
- {
- _root.introOverlay.littleDoor._visible = true;
- _root.introScreen.littleDoorBlack._visible = true;
- _root.introOverlay.littleDoor.gotoAndPlay("open");
- this.doorOpen = true;
- }
- if(this.x < 10)
- {
- _root.introOverlay.littleDoor.gotoAndPlay("close");
- _root.intro.wheelBot = false;
- _root.removeChar("wheelBot");
- }
- }
- function goingHomePoint()
- {
- if(this.x > 150)
- {
- this.dir = "L";
- this.xMovT = -4;
- this.f2 = "goingHome";
- }
- }
- function comp1()
- {
- this.comp1D = true;
- if(Math.abs(402 - this.x) < 4)
- {
- this.workComp1();
- }
- else
- {
- this.dir = this.x >= 402 ? "L" : "R";
- this.xMovT = this.dir != "L" ? 4 : -4;
- this.f2 = "gotoComp1";
- }
- }
- function gotoComp1()
- {
- if(Math.abs(402 - this.x) < 4)
- {
- this.workComp1();
- }
- }
- function workComp1()
- {
- this.xMovT = 0;
- this.clip.wheel.gotoAndStop("stop");
- this.f2 = "workingComp1";
- this.c2 = 0;
- this.c2Max = _root.randRange(30,120);
- _root.introScreen.wheelComp1.gotoAndPlay("go");
- _root.introScreen.wheelComp1Screen.gotoAndPlay("go");
- this.dir = "B";
- }
- function workingComp1()
- {
- this.c2 = this.c2 + 1;
- if(this.c2 == this.c2Max)
- {
- _root.introScreen.wheelComp1.gotoAndStop("main");
- this.dir = random(2) <= 0 ? "L" : "R";
- this.xMovT = this.dir != "L" ? 4 : -4;
- this.f2 = "wander";
- this.clip.wheel.gotoAndPlay(1);
- }
- }
- function comp2()
- {
- this.comp2D = true;
- if(Math.abs(951 - this.x) < 4)
- {
- this.workComp2();
- }
- else
- {
- this.dir = this.x >= 951 ? "L" : "R";
- this.xMovT = this.dir != "L" ? 4 : -4;
- this.f2 = "gotoComp2";
- }
- }
- function gotoComp2()
- {
- if(Math.abs(951 - this.x) < 4)
- {
- this.workComp2();
- }
- }
- function workComp2()
- {
- this.xMovT = 0;
- this.clip.wheel.gotoAndStop("stop");
- this.f2 = "workingComp2";
- this.c2 = 0;
- this.c2Max = _root.randRange(30,120);
- this.dir = "B";
- }
- function workingComp2()
- {
- this.c2 = this.c2 + 1;
- if(this.c2 == this.c2Max)
- {
- this.dir = random(2) <= 0 ? "L" : "R";
- this.xMovT = this.dir != "L" ? 4 : -4;
- this.f2 = "wander";
- this.clip.wheel.gotoAndPlay(1);
- }
- }
- function main()
- {
- this.c = this.c + 1;
- this[this.f2]();
- if(this.c == 40)
- {
- this.f2 = "wander";
- _root.introOverlay.littleDoor.gotoAndPlay("close");
- }
- if(this.c == 55)
- {
- _root.introScreen.littleDoorBlack._visible = false;
- _root.introOverlay.littleDoor._visible = false;
- }
- if(this.oldDir != this.dir)
- {
- this.clip.gotoAndStop(this.dir);
- if(this.oldDir == undefined || this.dir == "F")
- {
- this.clip.eyes.gotoAndStop(this.dir);
- }
- else if(this.oldDir == "B")
- {
- this.clip.eyes.gotoAndPlay("Bto" + this.dir);
- }
- else if(this.dir == "B")
- {
- this.clip.eyes.gotoAndPlay(this.oldDir + "toB");
- }
- else if(random(3) > 0)
- {
- if(this.dir == "R")
- {
- this.clip.eyes.gotoAndPlay("LtoR");
- }
- else
- {
- this.clip.eyes.gotoAndPlay("RtoL");
- }
- }
- else
- {
- this.clip.eyes.gotoAndPlay("spin" + this.dir);
- }
- }
- this.oldDir = this.dir;
- if(this.xMovT < this.xMov)
- {
- this.xMov -= 0.5;
- }
- else if(this.xMovT > this.xMov)
- {
- this.xMov += 0.5;
- }
- else
- {
- this.xMov = this.xMovT;
- }
- if(random(100) > 98)
- {
- this.clip.eyes.clip.gotoAndPlay("blink");
- }
- this.x += this.xMov + this.xA;
- this.clip._x = this.x;
- }
- }
-